home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / a_to_d / delwait / delwait.txt < prev   
Encoding:
Text File  |  1996-09-15  |  1.4 KB  |  40 lines

  1. Sample Delphi code that makes a Delphi app wait till ReportSmith's Runtime Viewer is ready for another command.
  2.  
  3. procedure TForm1.Button1Click(Sender: TObject);
  4. var
  5.   TheData: PChar;
  6.   PSetup : PChar;
  7.   s : string;
  8. begin
  9.  
  10. { This block of code causes the Runtime to display its "Print Setup" dialog box. }
  11. s := 'ExecuteMenu "File|Print Setup"';
  12. PSetup := StrAlloc(Length(s));
  13. StrPCopy(PSetup, s);
  14.   { DdeService is set to RS_Runtime, and }
  15.   { DdeTopic is set to Command.  }
  16. DdeClientConv1.ExecuteMacro(PSetup, false);
  17. StrDispose(PSetup);
  18.  
  19. { This is the block of code that makes Delphi wait until the Runtime Viewer is ready for another command. }
  20. TheData :=nil;            { Clear the variable. }
  21. s := '';            { Clear the variable. }
  22. while s <> 'Ready' do        { Loop until s = 'Ready' }
  23. begin
  24.   { DdeService is set to RS_Runtime, and }
  25.   { DdeTopic is set to System.  }
  26.   { 'Status' is a ReportSmith DDE Item.  It returns Ready when RS is not busy.}
  27.   TheData := DdeClientConv2.RequestData('Status'); { The method allocates memory. }
  28.   if TheData <> nil then
  29.   begin
  30.     s := StrPas(TheData);
  31.     Label1.Caption := StrPas(TheData); { This line is only to see what's being returned. }
  32.   end;
  33.   StrDispose(TheData);   { On-line help says to dispose of requested data. }
  34. end;
  35.  
  36. Report1.Run;        { Now, Runtime is ready for its next task.  }
  37. Report1.CloseReport(false);
  38.  
  39. end;
  40.